let actionCreator = (type, payload) => ({
    type,
    payload
});
export const GET_SINGERS = function(parm) {
    // console.log(parm);
    return function(dispatch) {
        fetch(`http://106.12.79.128:666/artist/list?cat=${parm}`)
            .then(body => body.json())
            .then(res => {
                dispatch(actionCreator("GET_SINGERS", res.artists));
            })
            .catch(err => {
                throw new Error(err);
            });
    };
};
export const GET_SINGERWORD = function(parm, parms) {
    console.log(parm, parms);
    return function(dispatch) {
        fetch(
            `http://106.12.79.128:666/artist/list?cat=${parms}&initial=${parm}`
        )
            .then(body => body.json())
            .then(res => {
                // console.log(res.artists);
                dispatch(actionCreator("GET_SINGERWORD", res.artists));
            })
            .catch(err => {
                throw new Error(err);
            });
    };
};
export const GET_REMENSINGER = function() {
    return function(dispatch) {
        fetch(`http://106.12.79.128:666/top/artists`)
            .then(body => body.json())
            .then(res => {
                // console.log(res.artists);
                dispatch(actionCreator("GET_REMENSINGER", res.artists));
            })
            .catch(err => {
                throw new Error(err);
            });
    };
};
